package com.neu.admin;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.doc.ResponseOK;
import com.neu.domain.ShoppingAdmin;
import com.neu.service.ShoppingAdminService;
import com.neu.util.JacksonUtil;
import com.neu.util.ResponseUtil;
import com.neu.util.bcrypt.BCryptPasswordEncoder;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import static com.neu.util.AdminResponseCode.ADMIN_INVALID_ACCOUNT;
@CrossOrigin
@RestController
@RequestMapping("/admin/profile")
@Validated
public class AdminProfileController {
    private final Log logger = LogFactory.getLog(AdminProfileController.class);
@Autowired
    private ShoppingAdminService shoppingAdminService;
  
@PostMapping("/password")
@RequiresAuthentication
//TODO
public Object create(@RequestBody ShoppingAdmin admin){
	int  rows=shoppingAdminService.updateById(admin);
	//更新操作，返回值是更新将结果的条数，那么肯定是 int
	if(rows  == 0) {
		return ResponseUtil.updatedDataFailed();
	}
	return ResponseUtil.ok();
}


}
